package com.swt.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.swt.service.CartService;
import com.swt.domain.Cart;
import com.swt.mapper.CartMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 苏
* @description 针对表【yesapi_shopxo_s_cart(ShopXO商城-购物车)】的数据库操作Service实现
* @createDate 2022-05-16 09:40:37
*/
@Service
public class CartServiceImpl implements CartService {
    @Autowired
    private CartMapper cartMapper;

    @Override
    public List<Cart> selsectAllCart() {
        return cartMapper.selectList(null);
    }

    @Override
    public int delectCart(String id) {
        return cartMapper.deleteById(id);
    }

    @Override
    public int updateCart(Cart goods) {
        return cartMapper.updateById(goods);
    }

    @Override
    public int inserCart(Cart goods) {
        return cartMapper.insert(goods);
    }

    @Override
    public Cart selectbyidCart(String id) {
        return cartMapper.selectById(id);
    }

    @Override
    public Page<Cart> pageCart(Integer page, Integer start) {
        Page<Cart> userPge = new Page<>(page,start);
        return cartMapper.selectPage(userPge,null);
    }
}




